
<div class="page-header" >
    <img class="img-rounded profile-thumbnail" src="{{ user.gravatar(size=256) }}">
    <div class="profile-header">
        <h1>{{ user.username }}</h1>
        {% if user.name or user.location %}
        <p>
            {% if user.name %}{{ user.name }}<br>{% endif %}
            {% if user.location %}
                From <a href="http://map.baidu.com/?q={{ user.location }}">{{ user.location }}</a><br>
            {% endif %}
        </p>
        {% endif %}
        {% if current_user.is_administrator() %}
        <p><a href="mailto:{{ user.email }}">{{ user.email }}</a></p>
        {% endif %}
        {% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
        <p>注册于：{{ moment(user.member_since).format('LLL') }}. 上次登录：{{ moment(user.last_seen).fromNow() }}.</p>
        <p>
            {% if current_user.can(Permission.FOLLOW) and user != current_user %}
                {% if not current_user.is_following(user) %}
                <a href="{{ url_for('.follow', username=user.username) }}" class="btn btn-primary">Follow</a>
                {% else %}
                <a href="{{ url_for('.unfollow', username=user.username) }}" class="btn btn-default">Unfollow</a>
                {% endif %}
            {% endif %}
            <a href="{{ url_for('.followers', username=user.username) }}">粉丝: <span class="badge">{{ user.followers.count() - 1 }}</span></a>
            <a href="{{ url_for('.followed_by', username=user.username) }}">关注: <span class="badge">{{ user.followed.count() - 1 }}</span></a>
            {% if current_user.is_authenticated and user != current_user and user.is_following(current_user) %}
            | <span class="label label-default">Follows you</span>
            {% endif %}
            {% if current_user.is_authenticated %}
            <a href="{{ url_for('.sendmessage', username=user.username) }}" class="btn btn-primary">发送私信</a>
                {% if  user == current_user %}                
                <small>（给自已发私信？程序猿是猴子请来的吗？)</small>
                {% endif %}
            {% else %}
            <a href="{{ url_for('auth.login') }}" class="btn btn-primary">私信</a>
            {% endif %}
        </p>
        <p>            
            {% if user == current_user %}
            <a class="btn btn-default" href="{{ url_for('.edit_profile') }}">编辑资料</a>            
            <a href="{{ url_for('auth.change_userset') }}" class="btn btn-default">账户设置</a>                            
            {% endif %}
            {% if current_user.is_administrator() %}
            <a class="btn btn-danger" href="{{ url_for('.edit_profile_admin', id=user.id) }}">编辑资料 [Admin]</a>
            {% endif %}
        </p>
    </div>
</div>
